﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Smart
{
    public abstract class Tablo : IDisposable
    {
        public string TabloAdi { get; set; }

        public void TruncateTable()
        {
            SqlCeClient.Get.Exec(string.Format("delete from {0}", this.TabloAdi));
        }

        public virtual IEnumerable<string> BulkImport(DateTime lastupdateDate) { yield return ""; }
        public virtual IEnumerable<string> BulkImport(int depoNo) { yield return ""; }
        public virtual IEnumerable<string> BulkImport() { yield return ""; }

        public void SaveChanges()
        {
            SqlCeClient.Get.insertOrUpdateRecord(this, false);
        }

        public void Remove()
        {
            SqlCeClient.Get.insertOrUpdateRecord(this, true);
        }

        public void Dispose()
        {
            GC.SuppressFinalize(this);
        }
    }
}
